//
//  StatusTextJudge.m
//  阿帕
//
//  Created by mac on 2020/1/2.
//  Copyright © 2020 GCY. All rights reserved.
//

#import "StatusTextJudge.h"

@implementation StatusTextJudge

+ (NSString *)authStatusJudge:(NSInteger)authStatus {
    
    /**
     authStatus
     0未审核/1审核中/2审核未通过/3审核通过
     */
    
    if (authStatus == 0) {
        return @"未审核";
    } else if (authStatus == 1) {
        return @"审核中";
    } else if (authStatus == 2) {
        return @"已驳回";
    } else if (authStatus == 3) {
        return @"审核通过";
    }
    return @"";
}

+ (void)authStatusJudge:(NSInteger)authStatus authMsg:(NSString *)authMsg label:(UILabel *)label {
    
    /**
     authStatus
     0未审核/1审核中/2审核未通过/3审核通过
     */
    
    if (authStatus == 0) {
        label.text = @"未审核";
        label.textColor = Light_TextColor;
    } else if (authStatus == 1) {
        label.text = @"审核中";
        label.textColor = Light_TextColor;
    } else if (authStatus == 2) {
        NSString *authStr = [NSString stringWithFormat:@"驳回原因:%@", authMsg];
        NSString *string = [@"已驳回\n" stringByAppendingString:authStr];
        NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:string];
        [attrStr setAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} range:[string rangeOfString:string]];
        [attrStr setAttributes:@{NSFontAttributeName:font(10)} range:[string rangeOfString:authStr]];
        [attrStr setAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} range:[string rangeOfString:authStr]];
        
        label.numberOfLines = 0;
        label.attributedText = attrStr;
    } else if (authStatus == 3) {
        label.text = @"审核通过";
        label.textColor = Light_TextColor;
    }
    
}

+ (void)authStatusJudge:(NSInteger)authStatus authMsg:(NSString *)authMsg label:(UILabel *)label button:(UIButton *)button {
    label.text = @"";
    label.hidden = !authMsg;
    
    if (authStatus == 0) {
        [button setTitle:@"未审核" forState:UIControlStateNormal];
        [button setBackgroundColor:[UIColor colorWithHexString:@"#FFFE03"]];
        [button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    } else if (authStatus == 1) {
        [button setTitle:@"审核中" forState:UIControlStateNormal];
        [button setBackgroundColor:[UIColor lightGrayColor]];
        [button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    } else if (authStatus == 2) {
        NSString *authStr = [NSString stringWithFormat:@"驳回原因:%@", authMsg];
        label.text = authStr;
        
        [button setTitle:@"已驳回" forState:UIControlStateNormal];
        [button setBackgroundColor:[UIColor redColor]];
        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    } else if (authStatus == 3) {
        [button setTitle:@"已审核" forState:UIControlStateNormal];
        [button setBackgroundColor:[UIColor colorWithHexString:@"#169BD5"]];
        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    
}


+ (NSString *)paidItemJudge:(NSString *)paidItem {
    
    //    paidItem 消费项目(0-充值，1-保证金 2-运费 3-保费 4-罚款 5-提现 6-信息费)
    if ([paidItem isEqual:@"0"]) {
        return @"充值";
    } else if ([paidItem isEqual:@"1"]) {
        return @"保证金";
    } else if ([paidItem isEqual:@"2"]) {
        return @"运费";
    } else if ([paidItem isEqual:@"3"]) {
        return @"保费";
    } else if ([paidItem isEqual:@"4"]) {
        return @"罚款";
    } else if ([paidItem isEqual:@"5"]) {
        return @"提现";
    } else if ([paidItem isEqual:@"6"]) {
        return @"信息费";
    }
    return @"";
}

+ (void)withdrawalRecordStatusJudge:(UILabel *)textLabel withStatus:(NSString *)string {
    
//    WAIT_AUDIT：待审核，AUDITED：已审核，REJECT：驳回，DEALING:处理中，SUCCESS：成功,FAIL：失败,
    if ([string isEqual:@"DEALING"]) {
        textLabel.text = @"处理中";
        textLabel.textColor = [UIColor cy_colorWithHexString:@"#2C7CF6"];
        textLabel.backgroundColor = [UIColor cy_colorWithHexString:@"#E9F2FE"];
        
    } else if ([string isEqual:@"SUCCESS"]) {
        
        textLabel.text = @"成功";
        textLabel.textColor = [UIColor cy_colorWithHexString:@"#0AD90F"];
        textLabel.backgroundColor = [UIColor cy_colorWithHexString:@"#E6FBE7"];
        
    } else if ([string isEqual:@"AUDITED"]) {
        
        textLabel.text = @"已审核";
        textLabel.textColor = [UIColor cy_colorWithHexString:@"#0AD90F"];
        textLabel.backgroundColor = [UIColor cy_colorWithHexString:@"#E6FBE7"];
        
    } else if ([string isEqual:@"WAIT_AUDIT"]) {
        
        textLabel.text = @"待审核";
        textLabel.textColor = [UIColor cy_colorWithHexString:@"#FF801D"];
        textLabel.backgroundColor = [UIColor cy_colorWithHexString:@"#FFF2E8"];
        
    } else if ([string isEqual:@"FAIL"]) {
        
        textLabel.text = @"失败";
        textLabel.textColor = [UIColor cy_colorWithHexString:@"#FF3D1D"];
        textLabel.backgroundColor = [UIColor cy_colorWithHexString:@"#FFEBE8"];
        
    } else if ([string isEqual:@"REJECT"]) {
        
        textLabel.text = @"驳回";
        textLabel.textColor = [UIColor cy_colorWithHexString:@"#FF3D1D"];
        textLabel.backgroundColor = [UIColor cy_colorWithHexString:@"#FFEBE8"];
        
    }
}

@end
